
import ViewBase from "../../engine/ViewBase";
import { SocketClient } from "../../net/SocketClient";
import { UIHelper } from "../util/UIHelper";

const { ccclass, property } = cc._decorator;

@ccclass
export default class ViewInvite extends ViewBase {


    private txtCode: cc.EditBox;

    onEnable(): void {
        super.onEnable()
        this.txtCode = this.getChild(this.node, "noinvite/txtCode", cc.EditBox)

        let btn_addok:cc.Node = this.findChild(this.node, "noinvite/btn_addok")
        UIHelper.onAddEvent(btn_addok, ()=>{
            if(this.txtCode.string == ""){
                UIHelper.showTip("请输入推广码")
                return;
            }
            this.closeView()
            SocketClient.req_bind_invite(parseInt(this.txtCode.string))
        })
    }




}
